<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://s3.pstatap.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <style>
        .block-content {
            display: flex;
            flex-wrap: wrap;
        }

        .goods-list {
            width: 25%;
            display: flex;
            justify-content: center;
            margin-bottom: 20px;
        }

        .goods-block {
            width: 260px;
            padding: 0 30px;
        }

        .goods-img {
            width: 200px;
            height: 200px;
        }

        .foot {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .add-card {
            width: 30px;
            height: 30px;
        }

        .mt20 {
            margin-top: 20px;
        }
    </style>

</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">对外经贸SHOP</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="#">购物车</a></li>

            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">查询</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="" style="color: red">xxxx</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">系统功能 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#" data-toggle="modal" data-target="#regModal">注册</a></li>
                        <li><a href="#" data-toggle="modal" data-target="#loginModal">登录</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#" onclick="exitSys()">安全退出</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="block-content">
    <div class="goods-list">
        <div class="goods-block">
            <img src="http://bigdata2cv2.oss-cn-beijing.aliyuncs.com/C%3A%5Cfakepath%5C%E5%9B%BE%E7%89%871.jpg"
                 alt="" class="goods-img">
            <div class="foot mt20">
                <div class="goods-name">名称</div>
                <img src="./img/cart.png"
                     alt="" class="add-card">
            </div>
            <div class="foot mt20">
                <div class="new-price">30.60元</div>
                <div class="old-price">50.00元</div>
            </div>
        </div>
    </div>

    <div class="goods-list">
        <div class="goods-block">
            <img src="http://bigdata2cv2.oss-cn-beijing.aliyuncs.com/C%3A%5Cfakepath%5C%E5%9B%BE%E7%89%871.jpg"
                 alt="" class="goods-img">
            <div class="foot mt20">
                <div class="goods-name">名称</div>
                <img src="./img/cart.png"
                     alt="" class="add-card">
            </div>
            <div class="foot mt20">
                <div class="new-price">30.60元</div>
                <div class="old-price">￥50.00元</div>
            </div>
        </div>
    </div>

    <div class="goods-list">
        <div class="goods-block">
            <img src="http://bigdata2cv2.oss-cn-beijing.aliyuncs.com/C%3A%5Cfakepath%5C%E5%9B%BE%E7%89%871.jpg"
                 alt="" class="goods-img">
            <div class="foot mt20">
                <div class="goods-name">名称</div>
                <img src="./img/cart.png"
                     alt="" class="add-card">
            </div>
            <div class="foot mt20">
                <div class="new-price">30.60元</div>
                <div class="old-price">50.00元</div>
            </div>
        </div>
    </div>

    <div class="goods-list">
        <div class="goods-block">
            <img src="http://bigdata2cv2.oss-cn-beijing.aliyuncs.com/C%3A%5Cfakepath%5C%E5%9B%BE%E7%89%871.jpg"
                 alt="" class="goods-img">
            <div class="foot mt20">
                <div class="goods-name">名称</div>
                <img src="./img/cart.png"
                     alt="" class="add-card">
            </div>
            <div class="foot mt20">
                <div class="new-price">30.60元</div>
                <div class="old-price">50.00元</div>
            </div>
        </div>
    </div>

    <div class="goods-list">
        <div class="goods-block">
            <img src="http://bigdata2cv2.oss-cn-beijing.aliyuncs.com/C%3A%5Cfakepath%5C%E5%9B%BE%E7%89%871.jpg"
                 alt="" class="goods-img">
            <div class="foot mt20">
                <div class="goods-name">名称</div>
                <img src="./img/cart.png"
                     alt="111" class="add-card">
            </div>
            <div class="foot mt20">
                <div class="new-price">30.60元</div>
                <div class="old-price">50.00元</div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myLoginModalLabel">登录窗口</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal">
                    <div class="form-group">
                        <label for="inputAccount" class="col-sm-2 control-label">账号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="inputLoginAccount" placeholder="请输入账号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputLoginPassword" class="col-sm-2 control-label">密码</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control" id="inputLoginPassword" placeholder="请输入密码">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" >登录</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script>
    window.onload = function (){
        loadGoods()
    }
    function  checkLogin(){
        let loginuser = localStorage.getItem('loginuser')
        if (loginuser !=null){
            document.getElementById("loginuser").innerText = loginuser
        }
    }

    function loadGoods(){
        $.ajax({
            url:'loadGoods',
            type:'GET',
            dataType:'text',
            success:function (res){
                console.log('消费者页面',res)
            }
        })
    }
    function exitSys(){
        let anw = window.confirm('确认要退出行吗')
        if (anw){
            $.ajax({
                url:'exitsys',
                type:'post',
                dataType:'text',
                success:function (res){
                    if(res == 'Y'){
                        localStorage.removeItem('loginuser')
                        document.getElementById("loginuser").innerText = ''
                        window.location.reload()    //退出系统后重新刷新页面

                    }
                }
            })
        }
    }
</script>